import axios from "./index";

//全部列表获取
export function gettables(names, permission_id) {
    return axios.post("/equipment/equipment_sel_api", { names: names, permission_id: permission_id }, {
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}

//闲置列表获取



//按部门查询列表
export function gettablebm(department, permission_id) {
    return axios.post("/equipment/equipment_sel_api", { department: department, permission_id: permission_id }, {
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}

//获取接受人数据
export function getjieshoulist() {
    
    return axios.post("/departments/departments_list_api",  {
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}

//登录
export function logining(name,pass) {
    return axios.post("/users/users_lonig_api",{names:name,pass:pass},{
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}
//equipment/apply_api?&id=1&number=ZXLT-DN2-001&real_department=1&project_leader=项目负责人&entry_name=项目点名称&button_code=1&approver=审批人&recipient=接收人"
//提交转移审批
export function submitSQ(obj) {
    return axios.post("/equipment/apply_api",obj,{
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}
//添加用户/users/users_ins_api?names=哈哈哈&pass=123456&department=1&position=1&telephone=1&permissionId=1
export function addusers(obj) {
    return axios.post("/users/users_ins_api",obj,{
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}
//获取审批列表 /equipment/traceability_list_api
export function getsplist() {
    return axios.post("/equipment/traceability_list_api",{
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}
//获取追溯表 /equipment/traceability_api?number=ZXLT-DN2-001
export function getzslist(id) {
    return axios.post("/equipment/traceability_api",{id:id},{
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}

///修改密码users/users_updpass_api?id=1&pass1=123&pass2=456
export function changepaaa(obj) {
    return axios.post("/users/users_updpass_api",obj,{
        headers: {
            'Access-Control-Allow-Origin': '*',  //解决cors头问题
            'Access-Control-Allow-Credentials': 'true', //解决session问题
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' //将表单数据传递转化为form-data类型
        },
        withCredentials: true
    })
}